package com.day12me;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
        try {
            ServerSocket ss = new ServerSocket(8877);
            Socket socket = ss.accept();

            BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
            String s = br.readLine();
            System.out.println("你好，客户端，这里是服务器：");

            socket.shutdownOutput();
            BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
            bw.write("你好，客户端弟弟，我是你哥");
            bw.flush();
            bw.close();

            socket.close();


        }catch(Exception ex){
            ex.printStackTrace();
        }
    }
}
